

// 第八  right_bottom
$.ajax({
    type: "post",
    async: true, //异步执行
    url: "sy/nydsj/zhsj",
    dataType: "json", //返回数据形式为json
    success: function (json) {
        var jsonarray= $.parseJSON(json);
        var myChart = echarts.init(document.getElementById('main8'));
// 指定图表的配置项和数据

        option = {
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                x:'10%',
                y:'30%',
                x2:'10%',
                y2:'20%',
                borderWidth:1
            },
            legend: {
                data: [aa, bb, cc, dd, ee],
                orient: 'horizontal',      // 布局方式，默认为水平布局，可选为：
                // 'horizontal' ¦ 'vertical'
                x: 'right',               // 水平安放位置，默认为全图居中，可选为：
                // 'center' ¦ 'left' ¦ 'right'
                // ¦ {number}（x坐标，单位px）
                y: '10px',                  // 垂直安放位置，默认为全图顶端，可选为：
                // 'top' ¦ 'bottom' ¦ 'center'
                // ¦ {number}（y坐标，单位px）
                // backgroundColor: 'rgba(0,0,0,0)',
                borderColor: '#ccc',       // 图例边框颜色
                borderWidth: 0,            // 图例边框线宽，单位px，默认为0（无边框）
                padding: 15,                // 图例内边距，单位px，默认各方向内边距为5，
                // 接受数组分别设定上右下左边距，同css
                itemGap: 10,               // 各个item之间的间隔，单位px，默认为10，
                                           // 横向布局时为水平间隔，纵向布局时为纵向间隔
                itemWidth: 20,             // 图例图形宽度
                itemHeight: 14,            // 图例图形高度
                textStyle: {
                    color: '#91F3FF'          // 图例文字颜色
                }
            },
            toolbox: {
                show: false,
                feature: {
                    dataZoom: {
                        yAxisIndex: 'none'
                    },
                    dataView: {readOnly: false},
                    magicType: {type: ['line', 'bar']},
                    restore: {},
                    saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: ['2018-1', '2018-2', '2018-3', '2018-4', '2018-5', '2018-6', '2018-7', '2018-8', '2018-9', '2018-10', '2018-11', '2018-12'],
                axisLabel: {
                    show: true,
                    textStyle: {
                        color: '#fff'
                    }
                }
            },
            yAxis: {
                type: 'value',
                axisLabel: {
                    formatter: '{value} ',
                    textStyle: {
                        color: '#fff'
                    }
                },

            },
            series: [
                {
                    name: aa,
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            {type: 'max', name: mm},
                            {type: 'min', name: '最小值'}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: 'average', name: '平均值'}
                        ]
                    }
                },
                {
                    name: bb,
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            {name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: 'average', name: '平均值'},
                            [{
                                symbol: 'none',
                                x: '90%',
                                yAxis: 'max'
                            }, {
                                symbol: 'circle',
                                label: {
                                    normal: {
                                        position: 'start',
                                        formatter: mm
                                    }
                                },
                                type: 'max',
                                name: mm
                            }]
                        ]
                    }
                },
                {
                    name: cc,
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            {name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: 'average', name: '平均值'},
                            [{
                                symbol: 'none',
                                x: '90%',
                                yAxis: 'max'
                            }, {
                                symbol: 'circle',
                                label: {
                                    normal: {
                                        position: 'start',
                                        formatter: mm
                                    }
                                },
                                type: 'max',
                                name: mm
                            }]
                        ]
                    }
                },
                {
                    name: dd,
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            {name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: 'average', name: '平均值'},
                            [{
                                symbol: 'none',
                                x: '90%',
                                yAxis: 'max'
                            }, {
                                symbol: 'circle',
                                label: {
                                    normal: {
                                        position: 'start',
                                        formatter: mm
                                    }
                                },
                                type: 'max',
                                name: mm
                            }]
                        ]
                    }
                },
                {
                    name: ee,
                    type: 'line',
                    data: [],
                    markPoint: {
                        data: [
                            {name: '周最低', value: -2, xAxis: 1, yAxis: -1.5}
                        ]
                    },
                    markLine: {
                        data: [
                            {type: 'average', name: '平均值'},
                            [{
                                symbol: 'none',
                                x: '90%',
                                yAxis: 'max'
                            }, {
                                symbol: 'circle',
                                label: {
                                    normal: {
                                        position: 'start',
                                        formatter: mm
                                    }
                                },
                                type: 'max',
                                name: mm
                            }]
                        ]
                    }
                }

            ]
        };
        for (var i = 0; i < jsonarray.length; i++) {
            option.series[0].data.push(jsonarray[i].strength);
            option.series[1].data.push(jsonarray[i].temperature);
            option.series[2].data.push(jsonarray[i].humidity);
            option.series[3].data.push(jsonarray[i].rainfall);
            option.series[1].data.push(jsonarray[i].quality);

        }


        myChart.setOption(option);
    },
    error: function (errorMsg) {
        alert("请求数据失败");
    }
});
